package com.lhy.skywalking.product.controller;

import com.lhy.skywalking.common.domain.AjaxResult;
import com.lhy.skywalking.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/products")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/{id}")
    public AjaxResult findById(@PathVariable("id") Long id) {
        return AjaxResult.success(productService.getProductById(id));
    }
}
